<script>
    $(document).ready(function() {
        $("#selectStyleCiculation").change(function() {
            $("#form_data").submit();
        });
        $(".radioButton").change(function() {
            $("#form_data").submit();
        });
    });
</script>
<!-- Begin one column window -->
<div class="onecolumn">
    <div class="header">
        <span style="color: red; text-align: center; font-weight: bold;">Danh sách tài liệu lưu thông</span>
    </div>
    <br class="clear"/>
    <div class="content">
        <!--<form id="form_data" name="form_data" action="" method="post">-->
        <?php
        $form = $this->form;
        $form->setAttribute('action', $this->url('ciculation-management/default', array('action' => 'selectStyleCiculation',)));
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <p style="float: right;">
            <?php
            echo $this->formInput($form->get('buttonReport'));
            ?>
        </p>
        <br style="clear">
        <p  style="float: left;">
            <?php
            echo $this->formRow($form->get('selectStyleCiculation'));
            ?>
        </p>
        <div id="traffic-document">
            <p>
                <?php
                echo $this->formRadio($form->get('radioButton'));
                ?>
            </p>
        </div>
        <?php if (isset($paginator) && $paginator != null) : ?>
            <table class="data" width="100%" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width:10px">
                            <?php
                            echo $this->formCheckbox($form->get('checkBoxAll'));
                            ?>
                        </th>
                        <th style="width:12%">Mã vạch</th>
                        <th style="width:25%">Tài liệu</th>
                        <th style="width:16%">Vị trí</th>
                        <th style="width:25%">Bạn đọc</th>
                        <th style="width:12%">Cán bộ TV</th>
                        <th style="width:10%">Ngày</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($paginator as $row) : ?>
                        <tr>
                            <td>
                                <?php
                                echo $this->formCheckbox($form->get('checkBoxAll'));
                                ?>
                            </td>
                            <td><?php echo $this->escapeHtml($row->bookBarcode) . '-' . $this->escapeHtml($row->serial); ?></td>
                            <td>
                                <?php
                                echo $this->escapeHtml($row->title . ' / ' . $allAuthor[$row->bookBarcode] . ' / Số trang: ' . $row->numberOfPages . ' / ' . $row->publisher . ' / Giá: ' . $row->price);
                                ?>
                            </td>
                            <td>
                                <?php
                                echo $this->escapeHtml($row->location);
                                ?>
                            </td>
                            <td>
                                <?php
                                echo $this->escapeHtml($row->cardBarcode . ' / ' . $row->fullName . ' / ' . $row->residentAddress);
                                ?>
                            </td>
                            <td>
                                <?php
                                echo $this->escapeHtml($row->librarianName);
                                ?>
                            </td>
                            <td>
                                <?php
                                $dateTime = explode('-', $row->timeSave);
                                echo $this->escapeHtml($dateTime[2] . '/' . $dateTime[1] . '/' . $dateTime[0]);
                                ?>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            <?php
            // add at the end of the file after the table
            echo $this->paginationControl(
                    // the paginator object
                    $this->paginator,
                    // the scrolling style; see http://zf2.readthedocs.org/en/release-2.1.4/modules/zend.paginator.usage.html#rendering-pages-with-view-scripts
                    'sliding',
                    // the partial to use to render the control
                    array('partial/paginator.phtml', 'Admin'),
                    // the route to link to when a user clicks a control link
                    array(
                'route' => 'return-docunent',
                    )
            );
            ?>
        <?php endif; ?>
        <?php echo $this->form()->closeTag($form); ?>
    </div>
</div>
<!-- End one column window -->